﻿@using System.Data;
@using DTcms.Web.MVC.UI.Controllers;
@using DTcms.Web.MVC.Areas.Web.Controllers;
@{
   DTcms.Model.sites site = ViewData["site"] as DTcms.Model.sites;
   DTcms.Model.sysconfig config = ViewData["sysConfig"] as DTcms.Model.sysconfig;
   Layout = "~/Areas/Web/Views/" + site.build_path + "/Shared/_LayoutShow.cshtml";
    BaseController bc = ViewBag.BasePage as BaseController;
    FeedbackController c = ViewBag.This as FeedbackController;
    DataTable list = ViewData["list"] as DataTable;
    ViewBag.Title = "留言反馈 - " + site.name;
    int page = int.Parse(ViewBag.Page as string);
    int totalcount = 0;
    DataTable contentlist = bc.get_article_list("content", 0, 0, "status=0");
    DataTable feedbackList = c.get_feedback_list(10, page, "", out totalcount);
    string pagelist = bc.get_page_link(10, page, totalcount, "feedback", "__id__");
}
@section HeaderContent{
   <script src="~/Scripts/jquery/jquery.form.min.js"></script>
}
@section Scripts{
   <script>
      $(function () {
         //初始化发表评论表单
         AjaxInitForm('#feedback_form', '#btnSubmit', 1);
      });
   </script>
}
<div class="section clearfix">
  <!--右边-->
  <div class="list-right">
    <div class="sidebar-box">
      <div class="line30"></div>
      <h3>栏目导航</h3>
      <ul class="navbar">
        @foreach(DataRow dr in contentlist.Rows){
        <li>
          <h4><a title="@dr["title"]" href="@bc.linkurl("content",dr["call_index"])">@dr["title"]</a></h4>
        </li>
        }
        <li>
          <h4><a href="@bc.linkurl("feedback")">留言反馈</a></h4>
        </li>
        <li>
          <h4><a href="@bc.linkurl("link")">友情链接</a></h4>
        </li>
      </ul>
      <div class="line20"></div>
      <h3>客户服务</h3>
      <div class="sidebar-txt">
        <p><strong>@site.company</strong></p>
        <p>地址：@site.address</p>
        <p>电话：@site.tel</p>
        <p>E-mail：@site.email</p>
        <p>新浪微博：http://weibo.com/dtcms</p>
      </div>
    </div>
  </div>
  <!--/右边-->
  
  <!--左边-->
  <div class="list-auto">
    <div class="ntitle">
      <h2>
        <a>留言反馈</a>
      </h2>
    </div>
    <!--留言列表-->
    <div class="comment-box">
      <ol class="comment-list">
       @foreach(DataRow dr in feedbackList.Rows){
          <li>
            <div class="avatar">
              <img src="@(config.webpath)template/@site.templet_path/images/user-avatar.png">
            </div>
            <div class="inner">
              <p>@Html.Raw(dr["content"])</p>
              <div class="meta">
                <span class="blue">@dr["user_name"]</span>
                <span class="time">@dr["add_time"]</span>
              </div>
            </div>
            @if(dr["reply_content"] != ""){
            <div class="answer">
              <div class="meta">
                <span class="right time">@dr["reply_time"]</span>
                <span class="blue">管理员回复：</span>
              </div>
              <p>@Html.Raw(dr["reply_content"])</p>
            </div>
            }
          </li>
       }
       @if(totalcount==0){
          <p style="line-height:35px;text-align:center;">暂无留言，快来发表留言吧！</p>
       }
      </ol>
    </div>
    <!--放置页码-->
    <div class="page-box" style="margin-left:-8px;">
      <div id="pagination" class="digg">@Html.Raw(pagelist)</div>
    </div>
    <div class="line10"></div>
    <!--/放置页码-->
    <!--/留言列表-->
    
    <!--发表留言-->
    <h2 class="base-tit">
      <span>发表留言<a name="Add" id="Add"></a></span>
    </h2>
    <div class="line10"></div>
    <form id="feedback_form" name="feedback_form" url="@(config.webpath)plugins/feedback/ajax.ashx?action=add&site=@site.id">
      <div class="form-box" style="border:0;">
        <dl>
          <dt>用户昵称：</dt>
          <dd>
            <input id="txtUserName" name="txtUserName" type="text" class="input txt" datatype="*" sucmsg=" " /> 
          </dd>
        </dl>
        <dl>
          <dt>联系电话：</dt>
          <dd>
            <input id="txtUserTel" name="txtUserTel" type="text" class="input txt" datatype="*0-20" sucmsg=" " />
          </dd>
        </dl>
        <dl>
          <dt>在线QQ：</dt>
          <dd>
            <input id="txtUserQQ" name="txtUserQQ" type="text" class="input txt" datatype="*0-20" sucmsg=" " />
          </dd>
        </dl>
        <dl>
          <dt>电子邮箱：</dt>
          <dd>
            <input id="txtUserEmail" name="txtUserEmail" type="text" class="input txt" />
          </dd>
        </dl>
        <dl>
          <dt>留言标题：</dt>
          <dd>
            <input id="txtTitle" name="txtTitle" type="text" class="input txt" datatype="*2-100" sucmsg=" " />
          </dd>
        </dl>
        <dl>
          <dt>留言内容：</dt>
          <dd>
            <textarea id="txtContent" name="txtContent" class="input txt" datatype="*" sucmsg=" " style="width:350px;height:80px;"></textarea>
          </dd>
        </dl>
        <dl>
          <dt>验证码：</dt>
          <dd>
            <input id="txtCode" name="txtCode" type="text" class="input small" datatype="*" sucmsg=" " />
            <a href="javascript:;" onclick="ToggleCode(this, '@(config.webpath)tools/verify_code.ashx');return false;"><img src="@(config.webpath)tools/verify_code.ashx" width="80" height="22" align="absmiddle" /> 看不清楚？</a>
            <span class="Validform_checktip"></span>
          </dd>
        </dl>
        <dl>
          <dt></dt>
          <dd>
           <input id="btnSubmit" name="btnSubmit" type="submit" value="发表留言" class="btn" />
          </dd>
        </dl>
      </div>
    </form>
    <!--发表留言-->
  </div>
  <!--/左边-->
</div>
